<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="a1" style="background-image:url(/index/assets/load.gif);background-size:100%;"></div>
<!--    <div id="a1" ></div>-->
</body>
<script src="/index/ckplayer/ckplayer.js"></script>
<!--<script src="//cdn.jsdelivr.net/npm/eruda"></script>-->
<script type="text/javascript" src="/index/js/jquery-3.4.1.min.js"></script>

<script>
    // eruda.init();

    // var flashvars={
    //     f:'/index/ckplayer/m3u8.swf',
    //     a:'http://sina.com-h-sina.com/20190112/23420_d8d75caa/index.m3u8',
    //     s:4,
    //     c:0
    // };
    var url = "{$section.url}";

    // var flashvars={f:'/index/ckplayer/m3u8.swf',a:encodeURIComponent(decodeURIComponent(url)),c:0,s:4,lv:0,p:1,v:100,loaded:'loadedHandler'}
    // var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
    // CKobject.embedSWF('/index/ckplayer/ckplayer.swf','a1','ckplayer_a1','100%','100%',flashvars,params);

    //
    var flashvars={
        f:'/index/ckplayer/m3u8.swf',
        a:url,
        s:4,
        c:0
    };
    var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'};
    var video=[url];
    CKobject.embed('/index/ckplayer/ckplayer.swf','a1','ckplayer_a1','100%','100%',false,flashvars,video,params);

    if('{$play_time}'){
        CKobject.getObjectById('ckplayer_a1').videoSeek(parseInt('{$play_time}'));
    }
    CKobject.getObjectById('ckplayer_a1').addListener('time',timeHandler);
    var info = '';
    function timeHandler(b){

        // console(player.totalTime);
        //用秒数来显示当前播放进度
        playTime = Math.floor(b);

        if('{$try_see}' > 0 && playTime>='{$try_see}'){
            // video.stop();
            // exitFullscreen();
            window.parent.$('.vip').show();

            window.parent.$('iframe').remove();
        }

        if(playTime%10==0 ){
            var player = CKobject.getObjectById('ckplayer_a1').getStatus();

            playRecord(playTime,parseInt(player.totalTime));
        }
    }


    var flag = -1;

    //观看记录
    function playRecord(playTime,allTime){

        if(flag!=playTime){

            $.post('{:url("playRecord")}',{movie_id:'{$movie.id}',section_id:'{$section.id}',play_time:playTime,all_time:allTime},function(res){
                // flag = 0;
                flag=playTime;

            })
        }
    }
</script>
</html>